package com.zrt.pad;

import com.zrt.pad.padpos.R;

import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences.Editor;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.inputmethod.EditorInfo;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.TextView.OnEditorActionListener;


public class SysSetActivity extends Activity implements OnClickListener, OnEditorActionListener {
	
	private EditText txtServerIp;
	private EditText txtServiceName;
	private EditText txtPrnName;
	private EditText txtTimeOut;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.syssetframe);
		findViewById(R.id.btnok).setOnClickListener(this);
		findViewById(R.id.btncancel).setOnClickListener(this);
		
		txtServerIp = (EditText) findViewById(R.id.txtServerIp);
		txtServiceName = (EditText) findViewById(R.id.txtServiceName);
		txtPrnName = (EditText) findViewById(R.id.txtPrnName);
		txtTimeOut = (EditText) findViewById(R.id.txtTimeOut);
	}
	
	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		switch (v.getId()) {	 
			case R.id.btnlogin: {
		        Intent intent = new Intent();
		        intent.setClass(SysSetActivity.this, LoginActivity.class);
		        SysSetActivity.this.startActivity(intent);
		        SysSetActivity.this.finish();
			}
			break;
			
	        case R.id.btncancel: {
	        	Intent intent = new Intent();
		        intent.setClass(SysSetActivity.this, LoginActivity.class);
		        SysSetActivity.this.startActivity(intent);
		        SysSetActivity.this.finish();
			}
			break;
			
			default: 
				break;
		}
	}

	@Override
	public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
		if (event!=null&&event.getKeyCode()== KeyEvent.KEYCODE_ENTER) {    
            //do something;
			switch (v.getId()) {
					case R.id.txtTimeOut: {
					    
					}
					break;				
					
				    default: 
				      break;
			} 
            return true;  
            
           }  
		return false;  
	}
	
	public boolean onKeyDown(int keyCode, KeyEvent event) {
		if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) {
			return false;
		}
		
		return false;
	}
}
